<?php
class Api_User
{
	/**
	 * 
	 * Tao user
	 * @param string $username
	 * @param string $email
	 * @return '': that bai, $user_dir : thanh cong
	 **/
	public function  createUser($username,$email)
	{
		$user_dir = '';
		$command= SITE_PATH."/library/api/shell/create-user.sh ".$username." ".$email;
		exec($command, $output);
		
        if(($output == null) || (!isset($output[0])) || (!isset($output[1])))
        	return '';
		
		if($output[0]=="cert") 
		    $user_dir=substr($output[1],0,-12);
		 
		return $user_dir;
    }
    /**
     * 
     * Xoa user
     * @param string $username
     * @param string $email
     * @return true: thanh cong false: that bai
     */
    public function deleteUser($username,$email)
    {
    	$command = SITE_PATH."/library/api/shell/delete-user.sh ".$username." ".$email;
    	exec($command, $output);
    	if($output == null)
    		return true;
    	else 
    		return false;	
    }  
       
}
